<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>

  <body>
    <!-- js传统做法 -->
    <input type="text" id="txt" />
    <p id="p">您输入了:</p>
    <script>
      let _txt = document.getElementById('txt')
      let _p = document.getElementById('p')
      _txt.oninput = function () {
        _p.innerText = '您输入了:' + _txt.value
      }
    </script>

    <!-- vue做法 -->
    <div id="app">
      <input type="text" v-model="msg" />
      <p>您输入了:{{msg}}</p>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          msg: 'hello'
        }
      })
    </script>
  </body>
</html>
